import request from '@/utils/request'

  export function login(user) {
    return request({
      url: '/user/login',
      method: 'post',
      data:user
    })
  }

  export function logout() {
    return request({
      url: '/user/logout',
      method: 'get',
    })
  }

  export function getPermissionList(data) {
    return request({
      url: '/user/getPermissionList',
      method: 'post',
      data:data
    })
  }

  export function deletePermission(id) {
    return request({
      url: '/user/deletePermission/'+id,
      method: 'post',
    })
  }

  export function updatePermission(data) {
    return request({
      url: '/user/updatePermisison',
      method: 'post',
      data:data
    })
  }

  export function addPermission(data) {
    return request({
      url: '/user/addPermision',
      method: 'post',
      data:data
    })
  }

  export function updatepassword(data) {
    return request({
      url: '/user/updatePassword',
      method: 'post',
      data:data
    })
  }

/**
 * 获取用户列表
 * @param {*} data 
 * @returns 
 */
  export function getUserList(data) {
    return request({
      url: '/user/getUserList',
      method: 'post',
      data
    })
  }

  
/**
 * 添加用户
 * @param {*} data 
 * @returns 
 */
export function addUser(data) {
  return request({
    url: '/user/addUser',
    method: 'post',
    data
  })
}

/**
 * 删除用户
 * @param {*} data 
 * @returns 
 */
export function deleteUser(id) {
  return request({
    url: '/user/deleteUser/'+id,
    method: 'post'
  })
}

/**
 * 修改用户
 * @param {*} data 
 * @returns 
 */
export function updateUser(data) {
  return request({
    url: '/user/updateUser',
    method: 'post',
    data
  })
}